<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	<script type="text/javascript">
		let arr = [1, 2, 3, 5, 6, 16, 33]
		let sum = 0
		// 循环数组
		for(let i = 0; i < arr.length; i++){
			console.log(arr[i])
			sum += arr[i]
		}
		console.log(sum)//71

		//forEach() 遍历
		// arr.forEach

		let add = 1
		arr.forEach(function(value,index,array,){
			/*
				value, index, array
				value:数组的每一项值
				index: 每一项下标
				array: 原数组
			*/
			console.log("value---,", value, "index---,", index, "原数组---,", array)
			add += value
		})
		console.log(add)//71
	</script>
</body>
</html>